package com.hawk.eye.server.controller.hawkeye;

import com.hawk.eye.common.core.ApiResult;
import com.hawk.eye.common.utils.Kv;
import com.hawk.eye.server.service.IStatisticsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @className: ServiceLogController
 * @description:
 * @author: salad
 * @date: 2023/9/30
 **/
@Slf4j
@RestController
@RequestMapping("/hawk-eye/statistics/")
@RequiredArgsConstructor
public class StatisticsController {

    private final IStatisticsService statisticsService;

    /**
     *
     */
    @GetMapping("/error-top")
    public ApiResult<List<Kv>> serviceErrorStatistics(@RequestParam Map<String, Object> params) {
        return ApiResult.ok(statisticsService.serviceErrorStatistics(params));
    }
    
    /**
     *
     */
    @GetMapping("/error-type")
    public ApiResult<List<Kv>> errorType(@RequestParam Map<String, Object> params) {
        return ApiResult.ok(statisticsService.errorType(params));
    }

    /**
     *
     */
    @GetMapping("/service-top")
    public ApiResult<List<Kv>> serviceErrorTop(@RequestParam Map<String, Object> params) {
        return ApiResult.ok(statisticsService.serviceErrorTop(params));
    }

    /**
     *
     */
    @GetMapping("/problem-top")
    public ApiResult<List<Kv>> problemTop(@RequestParam Map<String, Object> params) {
        return ApiResult.ok(statisticsService.problemTop(params));
    }

    /**
//     *
//     */
//    @GetMapping("/serviceStatistics")
//    public ApiResult<Kv> serviceErrorStatistics(Map<String, Object> params) {
//        return ApiResult.ok(statisticsService.serviceErrorStatistics(params));
//    }

}
